Component({
    externalClasses: [ "picker-bar-class" ],
    data: {
        pickerShow: !1,
        defaultIndex: 0
    },
    properties: {
        data: {
            type: Object,
            default: {}
        },
        value: {
            type: [ String, Number ],
            default: ""
        }
    },
    attached: function() {
        this.computeDefaultIndex();
    },
    methods: {
        onClick: function() {
            this.setData({
                pickerShow: !0
            });
        },
        onPickerConfirm: function(t) {
            var e = t.detail.index, a = this.data.data.pickerItems[e];
            this.triggerEvent("change", {
                prop: this.data.data.prop,
                item: a
            }), this.setData({
                pickerShow: !1
            });
        },
        onPickerCancel: function() {
            this.setData({
                pickerShow: !1
            });
        },
        computeDefaultIndex: function() {
            var t = this.data.value, e = this.data.data.pickerItems.findIndex(function(e) {
                return e.value === t;
            });
            e = e >= 0 ? e : 0, this.setData({
                defaultIndex: e
            });
        }
    }
});